#include "global.h"
#include <stdlib.h>

#include "Chro.h"
#include "NodeTable.h"
#include "Pop.h"
#include "Mutation.h"


CMutation::CMutation(void)
{
}

CMutation::~CMutation(void)
{
}

bool CMutation::CrossMutation(Chro* ch0,int nClass,int nItem )
{

	int target;
	if(ch0 == NULL)
	{
		return false;
	}
	
	int mut = nClass/10;
	if(Glovar::GetGlovar()->bRev)
	{
		mut = nClass/3;
	}

	for(int i=0;i<mut;i++)
	{
		target = rand()%nClass;
		ch0->UpdateNode(target,rand()%nItem);
	}
	return true;
}

